# 输入文件名，例如 test.txt
old_name = input("请输入需要备份的文件名：")

new_name = old_name[:old_name.rfind('.')] + '[备份]' + old_name[old_name.rfind('.'):]

# 向备份文件写入内容
# with open('xxx', 'r') as f, open('xxx[备份]', 'w') as f1:
#     for i in f:
#         f1.write(i)
